package com.hzit.paycommon.paycommonapi.enums;

/**
 * 支付状态枚举
 */
public enum  StatusEnum {

    UNPAY(0,"未支付"),
    FAIL(-1,"支付失败"),
    PAYING(1,"支付中"),
    SUCCESS(2,"支付成功");

     StatusEnum(int code,String desc){
         this.code = code;
         this.desc =desc;
    }



    private int code; //数据库对应的值

    private String desc; //描述


    public int getCode() {
        return code;
    }

    public void setCode(int code) {
        this.code = code;
    }

    public String getDesc() {
        return desc;
    }

    public void setDesc(String desc) {
        this.desc = desc;
    }

    /**
     * 根据code获取desc
     */
    public String getDesc(int code){

        for (StatusEnum statusEnum: StatusEnum.values()){
            if (statusEnum.getCode() == code){
                return statusEnum.getDesc();
            }
        }
        return null;
    }


}
